import 'package:flutter/material.dart';

//按钮样式
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  FocusNode _focusNode = FocusNode();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: SizedBox.expand(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(onPressed: () {}, child: Text('早起的年轻人')),
              SizedBox(height: 60),

              ElevatedButton.icon(
                icon: Icon(Icons.home),
                onPressed: () {
                  print('点击了  ElevatedButton');
                },

                style: ElevatedButton.styleFrom(
                  //图标 或者  文本的颜色
                  foregroundColor: Colors.white,
                  backgroundColor: Colors.blue.shade600,
                  disabledBackgroundColor: Colors.grey[200],
                  disabledForegroundColor: Colors.grey,
                  shadowColor: Colors.red,
                  surfaceTintColor: Colors.transparent,

                  splashFactory: InkRipple.splashFactory,

                  //图标
                  iconColor: Colors.yellow,
                  iconSize: 24,
                  iconAlignment: IconAlignment.start,

                  textStyle: TextStyle(fontSize: 22),

                  //尺寸
                  minimumSize: Size(200, 50),
                  fixedSize: Size(300, 50),
                  maximumSize: Size(300, 50),

                  //边框
                  side: BorderSide(color: Colors.red, width: 4),
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(40),
                  ),

                  elevation: 10,
                  enableFeedback: true,
                  visualDensity: VisualDensity.standard,
                ),
                label: Text('ElevatedButton'),
              ),
            ],
          ),
        ),
      ),
      // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
